<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <form action="login" method="post">
        <p>
            <span>用户名：</span><input type="text" id="username" required>
        </p>
        <p>
            <span>性别：</span>
            <input type="radio" name="sex" id="boy" value="man" required> 男
            <input type="radio" name="sex" id="girl" value="women" required> 女
        </p>
        <input type="submit">
    </form>
</div>

<script>
    'use strict';

    //获取表单数据
    let input_text = document.getElementById('username');
    let boy_radio = document.getElementById('boy');
    let girl_radio = document.getElementById('girl');

    //对于单选框或多选框 .value只能取到当前的值
    boy_radio.checked; //查看返回的结果 ，是否为true ，如是则被选中

</script>

</body>
</html>